import request from '@/utils/axios'

export type PostType = {
  id: number | undefined
  sort: number | undefined
  name: string
  code: string
  status: number
  remark: string
  create_time: Date
}

export interface PostPageReqType extends PageParam {
  name?: string
  code?: string
  status?: number
}

/**
 * 岗位接口
 */
export const PostApi = {
  // 新增
  create: (data: PostType) => {
    return request.post({ url: '/system/post/create', data, is_mock: true })
  },
  // 修改
  update: (data: PostType) => {
    return request.put({ url: '/system/post/update', data, is_mock: true })
  },
  // 删除
  delete: (id: number | string) => {
    return request.delete({ url: '/system/post/delete?id=' + id, is_mock: true })
  },
  // 查询详情
  detail: (id: number | string) => {
    return request.get({ url: '/system/post/detail?id=' + id, is_mock: true })
  },
  // 查询分页列表
  page: (params: PostPageReqType) => {
    return request.get({ url: '/system/post/page', params, is_mock: true })
  },
  // 查询列表
  simple: () => {
    return request.get({ url: '/system/post/simple-list', is_mock: true })
  },
  // 导出
  export: (params: PostPageReqType) => {
    return request.get({ url: '/system/post/export', params, is_mock: true })
  }
}
